<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>
<body>
<%@page import="java.util.*" %>
<%@page import="java.text.*" %>
<%@page import="com.voygern.task1.model.*" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<h2>Hello World!</h2>
<h3>now:<%=Calendar.getInstance().getTime().toString() %></h3>
<table border="2">
<tr>
<td width="150px">id</td><td width = "150px">name</td>
<td width="150px">create_at</td><td width="150px">update_at</td>
</tr> 
<c:forEach var="user" items="${users}">
	<tr>
			<td width="150px">${user.id}</td><td width = "150px">${user.username}</td>
			<td width="150px">${user.create_at}</td><td width="150px">${user.update_at}</td>
			</tr>
</c:forEach>

<%-- <%Object token = request.getAttribute("users"); 
	 if(token!=null)
	 { List<User> users = (List<User>) token;
	 	for(int i=0;i<users.size();i++){
	 		User u = users.get(i);%>
		<tr>
			<td width="150px"><%=u.getId() %></td><td width = "150px"><%=u.getName() %></td>
			<td width="150px"><%=u.getCreate_at() %></td><td width="150px"><%=u.getUpdate_at() %></td>
			</tr>
<%} }%> --%>
</table>
${message}<br>
<!-- <hr style="width:100%;height:1px;"> -->
<hr/>
<h2>Add Users</h2>
<form method="post" action="<%=request.getContextPath()%>/user.do?method=add">
id&nbsp;&nbsp;&nbsp;:<input type="text" name="id"/><br>
name :<input type="text" name="username"/><br>  
<input type="submit" value="Add"/>
</form>
<hr/>
<h2>Delete User</h2>
<form method="post" action="<%=request.getContextPath()%>/user.do?method=delete">
id&nbsp;&nbsp;&nbsp;:<input type="text" name="id"/><input type="submit" value="Delete"/>
</form>
</body>
</html>
